//
//  ZLFocusHintView.m
//  ZLCamera
//
//  Created by 科大 on 2024/4/19.
//

#import "ZLFocusHintView.h"
@interface ZLFocusHintView()
/// 路径
@property (nonatomic, strong) UIBezierPath *borderPath;
@end

@implementation ZLFocusHintView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.borderPath = [UIBezierPath bezierPath];
        self.userInteractionEnabled = NO;
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}
- (instancetype)init {
    if (self = [super init]) {
        self.borderPath = [UIBezierPath bezierPath];
        self.userInteractionEnabled = YES;
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}
- (void)drawRect:(CGRect)rect {
    self.borderPath = [UIBezierPath bezierPathWithRect:self.bounds];
    self.borderPath.lineCapStyle = kCGLineCapButt;
    self.borderPath.lineWidth = 1.5;
    UIColor *color = [UIColor colorWithWhite:1 alpha:0.6];
    [color set];
    
    [self.borderPath moveToPoint:CGPointMake(rect.size.width/2.0, 0)];
    [self.borderPath addLineToPoint:CGPointMake(rect.size.width/2.0, 0+8)];
    [self.borderPath moveToPoint:CGPointMake(0, rect.size.width/2.0)];
    [self.borderPath addLineToPoint:CGPointMake(0+8, rect.size.width/2.0)];
    [self.borderPath moveToPoint:CGPointMake(rect.size.width/2.0, rect.size.height)];
    [self.borderPath addLineToPoint:CGPointMake(rect.size.width/2.0, rect.size.height - 8)];
    [self.borderPath moveToPoint:CGPointMake(rect.size.width, rect.size.height/2.0)];
    [self.borderPath addLineToPoint:CGPointMake(rect.size.width - 8, rect.size.height/2.0)];
    
    [self.borderPath stroke];
}

@end
